package io.xxx.walle.task;

import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class JobConfig {

    @Bean
    public JobDetail JobDetail() {
        return JobBuilder.newJob(PushTaskJob.class)
                .withIdentity("pushTask", "task")
                .withDescription("消息推送任务")
                .storeDurably()
                .build();
    }

    @Bean
    public Trigger trigger() {
        return TriggerBuilder.newTrigger()
                .withIdentity("pushTaskTrigger", "task")
                .withSchedule(SimpleScheduleBuilder.repeatSecondlyForever(3))
                .forJob("pushTask", "task")
                .build();
    }
}
